-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
release-22.1: sql/stats: support rowCountEq = 0 in histogram.adjustCounts #82704
Conversation
The predicted histograms in statistics forecasts will often have buckets with NumEq = 0, and some predicted histograms will have _all_ buckets with NumEq = 0. This wasn't possible before forecasting, because the histograms produced by `EquiDepthHistogram` never have any buckets with NumEq = 0. If `adjustCounts` is called on such a histogram, `rowCountEq` and `distinctCountEq` will be zero. `adjustCounts` should still be able to fix such a histogram to have sum(NumRange) = rowCountTotal and sum(DistinctRange) = distinctCountTotal. This patch teaches `adjustCounts` to handle these histograms. (Similarly, predicted histograms could have all buckets with NumRange = 0, but this is already possible for histograms produced by `EquiDepthHistogram`, so `adjustCounts` already handles these.) Also, add a few more comments to `adjustCounts`. Assists: cockroachdb#79872 Release note: None
Thanks for opening a backport. Please check the backport criteria before merging:
If some of the basic criteria cannot be satisfied, ensure that the exceptional criteria are satisfied within.
Add a brief release justification to the body of your PR to justify this backport. Some other things to consider:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 2 files at r1, all commit messages.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @mgartner and @rytaft)
Thanks! I'll let this bake a little longer on master before merging. |
Closing this, will reopen later if we do decide to backport. |
Backport 1/1 commits from #82474.
/cc @cockroachdb/release
The predicted histograms in statistics forecasts will often have buckets
with NumEq = 0, and some predicted histograms will have all buckets
with NumEq = 0. This wasn't possible before forecasting, because the
histograms produced by
EquiDepthHistogram
never have any buckets withNumEq = 0.
If
adjustCounts
is called on such a histogram,rowCountEq
anddistinctCountEq
will be zero.adjustCounts
should still be able tofix such a histogram to have sum(NumRange) = rowCountTotal and
sum(DistinctRange) = distinctCountTotal. This patch teaches
adjustCounts
to handle these histograms.(Similarly, predicted histograms could have all buckets with
NumRange = 0, but this is already possible for histograms produced by
EquiDepthHistogram
, soadjustCounts
already handles these.)Also, add a few more comments to
adjustCounts
.Assists: #79872
Release note: None
Release justification: Low risk, high benefit change to existing functionality.